﻿//
// Copyright (c) 2024 BPer
//
#ifndef BPERPLAYER_SRC_BPERAUDIOPLAYMac_H_
#define BPERPLAYER_SRC_BPERAUDIOPLAYMac_H_

#include <bperaudiodev/BPerAudioPlay.h>

#if BPer_OS_APPLE
#include <bperaudiodev/mac/BPerAudioMac.h>


class BPerAudioPlayMac:public BPerAudioPlay{
public:
	BPerAudioPlayMac(BPerAVInfo* avinfo,BPerSynBufferManager* streams);
	~BPerAudioPlayMac();

    int32_t init();
    int32_t on_audio(BPerFrame* audioFrame);

    void start();
protected:
	void startLoop();
	void stopLoop();
    void closeAudio();

private:
     BPerBool m_loops;
    // BPerBool m_isStart;
     BPerBool m_isInited;

private:
    int32_t m_frames;
	int32_t ret;
    int32_t m_channel;
    uint32_t  m_sample;
    uint32_t m_macSample;
    uint32_t m_macChannel;
    uint32_t m_audiolen;

    BPerAudioMac* m_macAudio;
    BPerMacAudioCallback m_callback;
    uint8_t* m_buffer;
    //BPerAudioResample m_resample;
    //BPerFrame m_audioFrame;

};
#endif

#endif /* BPERPLAYER_SRC_BPERAUDIOPLAYALSA_H_ */
